//package com.xunqi.gulimall.gateway.config;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.cloud.gateway.filter.GatewayFilterChain;
//import org.springframework.cloud.gateway.filter.GlobalFilter;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.Ordered;
//import org.springframework.http.server.reactive.ServerHttpRequest;
//import org.springframework.web.server.ServerWebExchange;
//import reactor.core.publisher.Mono;
//
//@Configuration
//public class LoggingFilterConfig implements GlobalFilter  {
//
//    private static final Logger logger = LoggerFactory.getLogger(LoggingFilterConfig.class);
//
//    @Bean
//    public GlobalFilter customLoggingFilter() {
//        return new GlobalFilter() {
//            @Override
//            public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//                ServerHttpRequest request = exchange.getRequest();
//                String path = request.getPath().value();
//                String method = request.getMethodValue();
//
//                // 打印请求信息
//                logger.info("Incoming request: {} {}", method, path);
//                logger.info("Headers: {}", request.getHeaders());
//
//                return chain.filter(exchange);
//            }
//
//            @Override
//            public int getOrder() {
//                // 设置过滤器的执行顺序，数字越小优先级越高
//                return Ordered.HIGHEST_PRECEDENCE;
//            }
//        };
//    }
//
//    @Override
//    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
//        return null;
//    }
//}
